package com.lframework.xingyun.promo.mappers;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.lframework.starter.web.core.mapper.BaseMapper;
import com.lframework.xingyun.promo.entity.MarketingLimitprice;
import com.lframework.xingyun.promo.vo.limitprice.QueryMarketingLimitpriceVo;

import java.util.List;

/**
 * <p>
 * 限时特价活动 Mapper 接口
 * </p>
 *
 */
public interface MarketingLimitpriceMapper extends BaseMapper<MarketingLimitprice> {

    /**
     * 查询列表
     * @param vo
     * @return
     */
    default IPage<MarketingLimitprice> queryPage(QueryMarketingLimitpriceVo vo) {
        return defaultJoinWrapper()
                .like(StrUtil.isNotBlank(vo.getName()), MarketingLimitprice::getName, vo.getName())
                .page(PageDTO.of(vo.getPageIndex(), vo.getPageSize()));
    }

    /**
     * 查询列表
     * @param vo
     * @return
     */
    default List<MarketingLimitprice> queryList(QueryMarketingLimitpriceVo vo) {
        return defaultJoinWrapper()
                .like(StrUtil.isNotBlank(vo.getName()), MarketingLimitprice::getName, vo.getName())
                .list();
    }
}

